<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui-v2.8.9/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="__ADMIN__/lib/layui-v2.8.9/layui/css/layui.css">
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <style>
        .layui-btn+.layui-btn{
            margin-left: 0;
        }
        .layui-table td, .layui-table th
        {
            min-width: 50px !important;
        }
        .layui-table-cell{padding: 0 3px !important;}
        
        .layui-table td,.layui-table th,.layui-table tr,.layui-table,.layui-table thead,.layui-table tfoot,.layui-table-header,.layui-table-total{border-color:#000 !important}
        
        
        .layui-btn-xs {height: 22px !important;line-height: 22px !important;padding: 0 5px !important;font-size: 12px;}
        /*table thead .layui-table-col-special:nth-child(2n){background-color:#ddebf7}
        table thead .layui-table-col-special:nth-child(2n-1){background:#fce4d6}*/
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(n+1){background-color:#F0E3AB}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(n+5){background-color:#ddebf7}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(n+15){background-color:#fce4d6}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(n+25){background-color:#ddebf7}
        .layui-table-box .layui-table-body .layui-table tr td:nth-child(14){background-color:#F0E3AB}
        
        .layui-table-total  .layui-table tr td:nth-child(n+1){background-color:#F0E3AB}
        .layui-table-total  .layui-table tr td:nth-child(n+5){background-color:#ddebf7}
        .layui-table-total  .layui-table tr td:nth-child(n+15){background-color:#fce4d6}
        .layui-table-total  .layui-table tr td:nth-child(n+25){background-color:#ddebf7}
        .layui-table-total  .layui-table tr td:nth-child(n+33){background-color:#F0E3AB}
        
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(n+1){background-color:#F0E3AB}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(n+1){background-color:#F0E3AB}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(3){background-color:#ddebf7}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(4){background-color:#fce4d6}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(1) th:nth-child(5){background-color:#ddebf7}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(n+4){background-color:#ddebf7}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(n+14){background-color:#fce4d6}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(n+24){background-color:#ddebf7}
        .layui-table-box .layui-table-header .layui-table tr:nth-child(2) th:nth-child(13){background-color:#F0E3AB}
        
        .layui-table-fixed-r .layui-table-header .layui-table tr:nth-child(1) th:nth-child(3){background-color:#F0E3AB}
        
        .layui-btn-container{display:inline}
        .table-title{display:inline;font-size: 18px; margin-left: 30%;}
        .layui-table-fixed-r{border-left:1px solid #000}
    </style>
  </head>
  
  <body> 
    <div class="x-body x-admin" style="padding:0 10px">
      <xblock style="">
        <div class="layui-card-body" style="padding-left: 0;float:left;padding-left:20px;padding-top:0;">
          <form class="layui-form layui-col-space5" action="" method="get">
            
          </form>
        </div>
      </xblock>
      <div class="layui-table-body layui-table-main" style="width: 100%;min-height:0;">
        <table class="layui-table layui-form" lay-filter="performance" id="performance"> </table>
      </div>
    </div>
    <script type="text/html" id="checkStatusHtml">
      {{ d.check_status == 1 ? '<span class="layui-badge layui-bg-green"><i class="layui-icon layui-icon-ok"></i></span>' : '<a title="核对" class="layui-btn layui-btn-primary layui-btn-xs " lay-filter="check" lay-submit="" lay-id="'+d.id+'" href="javascript:;"><i class="layui-icon">核对</i></a>' }}
    </script>
     <!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
    <script type="text/html" id="barDemo">
    {{d.status == 0 && d.admin_id == {:session('uid','','admin')}?'<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">申报/修改</a>':'' }}
    {{d.status == 0 && ( {:session('group_id','','admin')} == 5||{:session('group_id','','admin')} == 1)?'<font color="red">未申报</font>':''}}
    {if condition="session('group_id','','admin') != 1"}
    {{d.status == 1 ?'待审核':'' }}
    {else}
    {{d.status == 1 ?'<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="check">审核</a>':'' }}
    {/if}
    {{d.status == 2 ?'<a class="layui-btn-primary layui-border-green" {:session('group_id','','admin') == 1?'lay-event="check"':''} title="点击可修改">通过</a>':'' }}
    </script>
    <script type="text/html" id="toolbarDemo">
      <div class="layui-btn-container">
        <button class="layui-btn" onclick="x_admin_show('业绩申报','{:url('performance/report')}',true)">业绩申报</button>
      </div>
      <div class="table-title">
        <form class="layui-form" action="" style="display: inline;">
            <div class="layui-input-inline" style="width:90px">
                <select>
                    <option>2023</option>
                </select>
            </div>
            年
            <div class="layui-input-inline" style="width:65px">
                <select lay-filter="month">
                    <option value="02" {$month=='02'?'selected':''}>02</option>
                    <option value="03" {$month=='03'?'selected':''}>03</option>
                    <option value="04" {$month=='04'?'selected':''}>04</option>
                    <option value="05" {$month=='05'?'selected':''}>05</option>
                    <option value="06" {$month=='06'?'selected':''}>06</option>
                    <option value="07" {$month=='07'?'selected':''}>07</option>
                    <option value="08" {$month=='08'?'selected':''}>08</option>
                    <option value="09" {$month=='09'?'selected':''}>09</option>
                    <option value="10" {$month=='10'?'selected':''}>10</option>
                    <option value="11" {$month=='11'?'selected':''}>11</option>
                    <option value="12" {$month=='12'?'selected':''}>12</option>
                </select>
            </div>
            赛事直播收益明细表
        </form>
      </div>
    </script>
    <script type="text/html" id="rank">
    {{d.LAY_TABLE_INDEX+1}}
    </script>
        
    <script>
      layui.use(['form','layer','jquery','table','util'], function(){
        form = layui.form,
        layer = layui.layer
        ,$ = layui.jquery
        ,table = layui.table
        ,util = layui.util;
        
        form.on('select(month)', function(data){
            window.location.href="?month="+data.value
        });
        
        table.render({
            elem: '#performance'
            ,height: $(window).height()-50
            ,url:'{:url('admin/performance/index')}?month={$month}&page=1'
            ,toolbar: '#toolbarDemo' 
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,limit: 500
            ,title: '业绩明细'
            ,totalRow: true
            ,cols: [
                function(){
                    var arr = 
                    [
                    {align: "center",field:'admin_name', fixed: 'left', width:70, sort: false,title:"营销"},
                    {align: "center",field:'title',  fixed: 'left', width:200, title:"活动名称" ,unresize1:true},
                    //{align: "center",field:'address', width:150,title:"活动地区"},
                    {align: "center",field:'vote_date', width:80,title:"投票时间"},
                    //{align: "center",field:'salesman_radio', width:90,title:"公司比例"},
                    
                    {align: "center",field:'total_income', width:80,title:"后台收益" ,totalRow: true},
                    {align: "center",field:'refund_income', width:80,title:"投错票"},
                    {align: "center",field:'reduce_income', width:80,title:"* * *",totalRow: true},
                    
                    {align: "center",field:'live_fee', width:60,title:"直播费",totalRow: true},
                    {align: "center",field:'plive_fee', width:80,title:"照片直播",totalRow: true},
                    {align: "center",field:'gift_fee', width:60,title:"礼品费",totalRow: true},
                    {align: "center",field:'travel_fee', width:60,title:"差旅费"},
                    {align: "center",field:'other_fee', width:80,title:"其它费用"},
                    
                    {align: "center",field:'real_income', width:80,title:"实际收益",totalRow: true},
    
                    {align: "center",field:'ratio', width:80,title:"分成比例"},
                    {align: "center",field:'client_income', width:80,title:"客户收益",totalRow: true},
                    {align: "center",field:'client_sxfee_radio', width:100,title:"手续费点位"},
                    {align: "center",field:'client_charges', width:60,title:"手续费",totalRow: true},
                    {align: "center",field:'client_live_fee', width:60,title:"直播费"},
                    {align: "center",field:'client_plive_fee', width:80,title:"照片直播"},
                    {align: "center",field:'client_gift_fee', width:60,title:"礼品费",totalRow: true},
                    {align: "center",field:'client_travel_fee', width:60,title:"差旅费"},
                    {align: "center",field:'client_other_fee', width:80,title:"其它费用"},
                    {align: "center",field:'client_other_income', width:80,title:"其它收益"},
                    {align: "center",field:'client_final_income', width:80,title:"实际收益",totalRow: true},
                    
                    {align: "center",field:'salesman_performance', width:80,title:"赛事业绩",totalRow: true},
                    {align: "center",field:'salesman_charges', width:60,title:"手续费",totalRow: true},
                    {align: "center",field:'salesman_recommend_fee', width:60,title:"介绍费"},
                    {align: "center",field:'salesman_live_fee', width:60,title:"直播费",totalRow: true},
                    {align: "center",field:'salesman_plive_fee', width:80,title:"照片直播",totalRow: true},
                    {align: "center",field:'salesman_gift_fee', width:60,title:"礼品费",totalRow: true},
                    {align: "center",field:'salesman_travel_fee', width:60,title:"差旅费"},
                    {align: "center",field:'salesman_other_fee', width:80,title:"其它费用"},
                    {align: "center",field:'salesman_other_performance', width:80,title:"其它业绩"},
                    ]
                    var local = layui.data('table-filter-yjmx');
                    console.log(local);
                    console.log(arr);
                    layui.each(arr, function(index, item){
                        if(item.field in local){
                            item.hide = local[item.field];
                        }
                    });
                    console.log(arr);
                    
                    return arr;
                }()
            ]
            ,page: false
            ,done: function(res, curr, count){

                var that = this;
                that.elem.next().on('mousedown', 'input[lay-filter="LAY_TABLE_TOOL_COLS"]+', function(){
                    var input = $(this).prev()[0];
                    layui.data('table-filter-yjmx', {
                        key: input.name
                        ,value: input.checked
                    })
                });
                
                $('.layui-table-total tr td').css('background-color','#F2F2F2');
                
                {if condition=" session('group_id','','admin') == 1"}
                $('.layui-table-total tr td[data-field="salesman_final_performance"]').css({'position':'fixed','z-index':'1','right':'212px','border-left':'1px solid #000'});
                $('.layui-table-total tr td[data-key="1-0-6"]').css({'position':'fixed','z-index':'1','right':'111px'});
                $('.layui-table-total tr td[data-field="check_remark"]').css({'position':'fixed','z-index':'1','right':'10px'});

                $('.layui-table-total tr td[data-field="salesman_other_performance"]').css({'padding-right':'283px'});
                {else}
                $('.layui-table-total tr td[data-field="salesman_final_performance"]').css({'position':'fixed','z-index':'1','right':'102px'});
                $('.layui-table-total tr td[data-key="1-0-6"]').css({'position':'fixed','z-index':'1','right':'10px'});
                $('.layui-table-total tr td[data-field="salesman_other_performance"]').css({'padding-right':'183px'});
                {/if}
                
                if($('.layui-table-box .layui-table-main table').height() < $('.layui-table-box .layui-table-main').height() )
                {
                    $('.layui-table-box .layui-table-main').height( $('.layui-table-box .layui-table-main table').height() +20 )
                }

            }
        });

        table.on('edit(performance)', function(obj){
            var value = obj.value 
            ,data = obj.data 
            ,field = obj.field;
            console.log(obj);
            
        });

        table.on('tool(performance)', function(obj){
            var data = obj.data;
            if(obj.event === 'del'){
              layer.confirm('确认要删除吗？',function(index){
                  $.ajax({
                    type:'POST',
                    dataType:'json',
                    data:{id:data.id},
                    url:"",
                    success:function(o){
                      layer.msg(o.msg,{icon:o.icon,time:1000});
                      obj.del();
                    }
                  });
              });
            } else if(obj.event == 'edit'){
                x_admin_show('查看详情','{:url('performance/report')}/?id='+data.id,true)
            } else if(obj.event == 'check'){
                x_admin_show('查看详情','{:url('performance/report')}/id/'+data.id,true)
            /*
              layer.confirm('确认要审核此条吗？',function(index){
                  $.ajax({
                    type:'POST',
                    dataType:'json',
                    data:{id:data.id},
                    url:"{:url('performance/check')}",
                    success:function(o){
                        layer.msg(o.msg,{icon:o.icon,time:1000});
                        if(o.code == 1)
                            window.location.reload();
                    }
                  });
              });*/
            }
        });

      });

    </script>
  </body>

</html>